package com.baozun.houji.me.viewmodel

import androidx.lifecycle.MutableLiveData
import com.baozhun.mall.common.model.bean.*
import com.baozun.houji.me.network.mMeApiService
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request

/**
 *  @Title：CollectionViewModel
 * @Description：
 * @Author：xuefeng.zhu
 * @Since：2022/11/4
 * @Version：1.0.0
 */
class BrowseHistoryViewModel : BaseViewModel() {
    private var mCurrentPage = 1
    var mBrowseHistoryList = MutableLiveData<ApiPagerResponse<ArrayList<GoodsInfoBean>>>()

    /**
     * 获取浏览记录
     */
    fun getBrowseHistoryList(isRefresh: Boolean? = true) {
        if (isRefresh == true) mCurrentPage = 1
        request({
            mMeApiService.getBrowseHistoryList(mCurrentPage)
        }, {
            mBrowseHistoryList.value = it
            mCurrentPage += 1
        }, isShowDialog = false, showErrorMsg = false)
    }
}